package cn.net.yato.picture.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.regex.Pattern;

/**
 * @ClassName Permission
 * @Description 权限表
 * @Author yato
 * @Date 2020/2/17 13:02
 * @Version 1.0
 */
@Data
@TableName(value = "permission")
public class Permission implements Serializable {
    /**
     * 自增id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private long id;
    /**
     * 权限id 唯一
     */
    @TableField(value = "permission_id")
    private String permissionId;
    /**
     * 权限名称 唯一
     */
    @TableField(value = "name")
    private String name;
    /**
     * 权限描述
     */
    @TableField(value = "description")
    private String description;
    /**
     * 权限访问路径
     */
    @TableField(value = "url")
    private String url;
    /**
     * 权限标识
     */
    @TableField(value = "perms")
    private String perms;
    /**
     * 父级权限id
     */
    @TableField(value = "parent_id")
    private String parentId;
    /**
     * 权限类型   0：目录   1：菜单   2：按钮
     */
    @TableField(value = "type")
    private int type;
    /**
     * 权限图标
     */
    @TableField(value = "icon")
    private String icon;
    /**
     * 权限状态
     * 1：有效
     * 0：删除
     */
    @TableField(value = "status")
    private int status;
    /**
     * 权限创建日期
     */
    @TableField(value = "create_time")
    private Date createTime;
    /**
     * 权限修改日期
     */
    @TableField(value = "update_time")
    private Date updateTime;

    public Permission() {
    }

    public Permission(long id, String permissionId, String name, String description, String url, String perms, String parentId, int type, String icon, int status, Date createTime, Date updateTime) {
        this.id = id;
        this.permissionId = permissionId;
        this.name = name;
        this.description = description;
        this.url = url;
        this.perms = perms;
        this.parentId = parentId;
        this.type = type;
        this.icon = icon;
        this.status = status;
        this.createTime = createTime;
        this.updateTime = updateTime;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getPermissionId() {
        return permissionId;
    }

    public void setPermissionId(String permissionId) {
        this.permissionId = permissionId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        url = Pattern.compile("\t|\r|\n").matcher(url).replaceAll("");
        this.url = url;
    }

    public String getPerms() {
        return perms;
    }

    public void setPerms(String perms) {
        this.perms = perms;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}
